import axios from "./api"; // 倒入 api
import config from "./config.js"; // 倒入默认配置
export const BASEURL = config.baseURL;

/* 将所有接口统一起来便于维护
 * 如果项目很大可以将 url 独立成文件，接口分成不同的模块
 */

export const IMAGEPATH = BASEURL + "appserver";

// 活动管理-问卷项目
export const GET_ACTIVITY_QUESTIONNAIRES = (params) => {
  return axios({
    url: "activity/questionnaires",
    method: "GET",
    params,
  });
};

// 活动管理-获取活动列表
export const GET_ACTIVITY_SEARCH = (params) => {
  return axios({
    url: "activity/search",
    method: "GET",
    params,
  });
};

// 活动管理-获取活动列表-删除活动
export const DELETE_ACTIVITY_INFO = (params) => {
  return axios({
    url: "activity/delete",
    method: "GET",
    params,
  });
};

// 活动管理-获取活动列表-批量导出活动
export const DOWNLOAD_ACTIVITY_EXPORT = BASEURL + "activity/export";

// 活动管理-获取活动列表-获取活动详情
export const GET_ACTIVITY_INFO = (params) => {
  return axios({
    url: "activity/info",
    method: "GET",
    params,
  });
};

// 活动管理-获取活动列表-新增活动
export const ADD_ACTIVITY_INFO = (params) => {
  return axios({
    url: "activity/add",
    method: "POST",
    data: params,
  });
};

// 活动管理-获取活动列表-编辑活动
export const EDIT_ACTIVITY_INFO = (params) => {
  return axios({
    url: "activity/edit",
    method: "POST",
    data: params,
  });
};

// 活动管理-获取活动列表-获取活动列表(不分页)
export const GET_ACTIVITY_OPTIONS = (params) => {
  return axios({
    url: "activity/options",
    method: "GET",
    params,
  });
};

// 线索-线索管理-获取线索列表
export const GET_CLUE_OPTIONS = (params) => {
  return axios({
    url: "activity/clue/search",
    method: "GET",
    params,
  });
};

// 线索-线索管理-批量导出线索
export const DOWNLOAD_ACTIVITY_CLUE_EXPORT = BASEURL + "activity/clue/export";

// 线索-线索管理-删除线索
export const DELETE_ACTIVITY_CLUE_INFO = (params) => {
  return axios({
    url: "activity/clue/delete",
    method: "GET",
    params,
  });
};

// 线索-待分配线索-获取列表
export const GET_UNASSIGNED_CLUE_SEARCH = (params) => {
  return axios({
    url: "activity/clue/unassigned/search",
    method: "GET",
    params,
  });
};

// 线索-待分配线索-批量导出线索
export const DOWNLOAD_CLUE_UNASSIGNED_EXPORT =
  BASEURL + "activity/clue/unassigned/export";

// 线索-待分配线索-批量智能分配
export const SAVE_CLUE_SMARTASSIGN = (params) => {
  return axios({
    url: "activity/clue/smartassign",
    method: "POST",
    data: params,
  });
};

// 线索-分配规则-获取列表
export const GET_ASSIGNMENT_SEARCH = (params) => {
  return axios({
    url: "assignment/search",
    method: "GET",
    params,
  });
};

// 线索-分配规则-新增分配人
export const ADD_ASSIGNMENT_INFO = (params) => {
  return axios({
    url: "assignment/add",
    method: "POST",
    data: params,
  });
};

// 线索-分配规则-获取分配人详情
export const GET_ASSIGNMENT_INFO = (params) => {
  return axios({
    url: "assignment/info",
    method: "GET",
    params,
  });
};

// 线索-分配规则-编辑分配人
export const EDIT_ASSIGNMENT_INFO = (params) => {
  return axios({
    url: "assignment/edit",
    method: "POST",
    data: params,
  });
};

// 线索-分配规则-删除分配人
export const DELETE_ASSIGNMENT_INFO = (params) => {
  return axios({
    url: "assignment/delete",
    method: "GET",
    params,
  });
};

// 线索-分配统计-获取列表
export const GET_ASSIGNMENT_SEARCHSTAT = (params) => {
  return axios({
    url: "assignment/searchStat",
    method: "GET",
    params,
  });
};

// 线索-分配统计-批量导出
export const DOWNLOAD_ASSIGNMENT_EXPORTSTAT = BASEURL + "assignment/exportStat";

// 批量智能分配-获取分配数量
export const GET_CLUE_ASSIGNCNT = (params) => {
  return axios({
    url: "activity/clue/assigncnt",
    method: "POST",
    data: params,
  });
};

// 批量智能分配-可分配人列表
export const GET_ASSIGNMENT_ASSIGNUSERS = (params) => {
  return axios({
    url: "assignment/assignusers",
    method: "GET",
    params,
  });
};

// 批量智能分配-可分配人下拉列表
export const GET_ASSIGNMENT_OPTIONS = (params) => {
  return axios({
    url: "assignment/options",
    method: "GET",
    params,
  });
};

// 批量手动分配
export const SAVE_CLUE_MANUALASSIGN = (params) => {
  return axios({
    url: "activity/clue/manualassign",
    method: "POST",
    data: params,
  });
};

// 线索-待分配线索-批量导入线索
export const IMPORT_CLUE_INFO = BASEURL + "activity/clue/import";

// 线索-待分配线索-录入线索
export const ADD_CLUE_INFO = (params) => {
  return axios({
    url: "activity/clue/add",
    method: "POST",
    data: params,
  });
};

// 线索-分配规则-启停分配
export const UPDATE_ASSIGNMENT_STATUS = (params) => {
  return axios({
    url: "assignment/startstop",
    method: "GET",
    params,
  });
};

// 线索-分配规则-重置增减比例
export const REST_ASSIGNMENT_RATE = (params) => {
  return axios({
    url: "assignment/resetratio",
    method: "GET",
    params,
  });
};

// 线索-活动管理-下载二维码
export const DOWNLOAD_ACTIVITY_QRCODE = BASEURL + "activity/qrcode";
// export const DOWNLOAD_ACTIVITY_QRCODE = (params) => {
//     return axios({
//         url: 'activity/qrcode',
//         method: 'GET',
//         params,
//     })
// }

// 线索-待分配线-获取牙齿问题
export const GET_QUESTIONNAIRES_OPTIONS = (params) => {
  return axios({
    url: "activity/questionnaires/options",
    method: "GET",
    params,
  });
};

// 线索-线索管理-获取线索详情
export const GET_CLUE_INFO = (params) => {
  return axios({
    url: "activity/clue/info",
    method: "GET",
    params,
  });
};

// 线索-线索管理-编辑线索
export const EDIT_CLUE_INFO = (params) => {
  return axios({
    url: "activity/clue/edit",
    method: "POST",
    data: params,
  });
};
